package com.hhkj.study.admin.resource.model.res;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.hhkj.study.admin.resource.model.podo.ResourceCourseLivePo;
import com.ruoyi.common.constant.Constants;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
*
* @author SERVER
* @since 2024-09-06
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ResourceCourseLiveRes extends ResourceCourseLivePo {

    /**
     * 开始结束时间 格式化后
     */
    private String startEndTime;

    public String getStartEndTime() {
        if (ObjectUtil.isNull(this.getStartTime())) {
            return Constants.DATE_NOT_SET;
        }
        return StrUtil.format("{}至{}", DateUtil.format(this.getStartTime(), DatePattern.NORM_DATETIME_PATTERN), DateUtil.format(this.getEndTime(), DatePattern.NORM_DATETIME_PATTERN));
    }
}